﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Repo7.BusinessLogic.Utils;
using Repo7.BusinessLogic;
using Repo7.BusinessLogic.Network.Commander;
using System.Net;
using System.Threading;
using Repo7.BusinessLogic.Network.FileTransfer;

namespace Repo7.ClientTest
{
    class Program
    {
        static void Main(string[] args)
        {
            RepoManager manager = new RepoManager();
            Console.WriteLine("Init repo manager...");
            manager.InitRepoManager();
            Console.WriteLine("Waiting for changes...");
            Console.ReadKey();
        }

        //static void Main(string[] args)
        //{
        //    //RepoManager manager = new RepoManager();
        //    //manager.InitRepoManager();

        //    ThreadPool.QueueUserWorkItem(new WaitCallback(Send), null);

        //    Thread.Sleep(1000);

        //    ThreadPool.QueueUserWorkItem(new WaitCallback(Receive), null);

        //    Console.ReadKey();
        //}

        //static void Send(object o)
        //{
        //    //RepoCommander commander = new RepoCommander(new Action<RepoCommand>(MessageReceived), 10);
        //    IPAddress address = IPAddress.Parse("127.0.0.1");
        //    IPEndPoint endPoint = new IPEndPoint(address, 12000);
        //    //commander.StartListening(endPoint);

        //    RepoFileTransfer ft = new RepoFileTransfer();
        //    ft.StartListening(endPoint);
        //}

        //static void MessageReceived(object command)
        //{
        //    Console.WriteLine(command.ToString());   
        //}

        //static void Receive(object o)
        //{
        //    //RepoCommander commander = new RepoCommander(new Action<RepoCommand>(MessageReceived), 10);
        //    IPAddress address = IPAddress.Parse("127.0.0.1");
        //    IPEndPoint endPoint = new IPEndPoint(address, 12000);
        //    //RepoCommand command = new RepoCommand() { CommandType = CommandTypes.RECEIVE_FILE_TRANSFER, FileName = "Ana" };
        //    //commander.SendCommand(command, endPoint, 10);
        //    RepoFileTransfer ft = new RepoFileTransfer();
        //    ft.SendFile("OSC_101_2012.avi", endPoint);
        //}
    }
}
